<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>


    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.1.js"></script>

</head>
<body>

<form class="layui-form" action="" lay-filter="formData">
    <div class="layui-form-item">
        <label class="layui-form-label">原密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" required  lay-verify="required" placeholder="请输入原密码" autocomplete="off" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">新密码</label>
        <div class="layui-input-block">
            <input type="password" name="newpass" required  lay-verify="required" placeholder="请输入新密码" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-block">
            <input type="password" name="newpass1" required  lay-verify="required" placeholder="请输入确认密码" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formData" id="submitbutton" >立即提交</button>
        </div>
    </div>


</form>

<script>
    var form = null;

    //Demo
    layui.use('form', function(){
        form = layui.form;
        //监听提交
        form.on('submit(formData)', function(data){
            // layer.msg(JSON.stringify(data.field));
            postBody("/admin/api/UserController/updatePass",data.field,function (res) {
                top.alert(res.msg);
            })
            return false;
        });
    });

    function getData() {
        var data1 = form.val("formData");
        return data1;
    }

    function setData(data) {
        //给表单赋值
        form.val("formData", data);
    }

</script>

</body>
</html>
